"""
    ScrollBack - a library for making retro 80's and 90's style games.
    
    author:     Bradley K. Harms (a.k.a. TheMusicGuy)
    email:      musicguy@alphaios.net
    website:    http://code.google.com/p/scrollback/
    
    To make complete use of this library, the following other Python
    packages must be installed on the system:
    
    * Pygame.
      - Required to run ScrollBack at all.
      - http://www.pygame.org/
    * Numpy.
      - Required for tile maps.
      - http://numpy.scipy.org/
      - Also available from the Pygame website (above).
    * json or simplejson.
      - JSON support for Python. Required for loading any type of
        resource other than Pygame surfaces.
      - http://pypi.python.org/pypi/simplejson/
      - Installed by default for Python versions >= 2.6, extra package
        (above) needed for Python 2.5 and earlier.
        
    Documentation for this project is plentiful, but not well
    organized. Most documentation is embedded into the library using
    Python docstrings, but some of it exists on the project wiki at the
    url listed at top. Wiki documentation is sometimes out of date.
    
    Some todos for this project:
    
    TODO: Unit tests for all features.
"""

# ~~~ SYSTEM IMPORTS ~~~

import sys
import warnings

# Make sure Pygame is installed...
try:
    import pygame
except ImportError:
    raise ImportError(
    """
    
    Pygame is not intalled on this system. You must install Pygame before you
    can use ScrollBack. Go to http://www.pygame.org to download and install
    Pygame.
    """)

# ~~~ CONSTANTS ~~~

# The "I don't care what ID to use" constant
ID_ANY = "_id_any_"


# ~~~ INTERNAL IMPORTS ~~~

# Import whichever version of vector is available, preferring the C version
try:
    import cvector as vector
except ImportError:
    import pvector as vector
sys.modules['sbak.vector'] = vector

import error
#import debug
import base
import misc
import event
import video
import draw
import ui
import group
import resman
import image
import tilelist
import app
import entity
import world
    
__all__ = [
    # Constants
    'ID_ANY',
    
    # Modules
    'error',
#    'debug',
    'base',
    'misc',
    'event',
    'video',
    'draw',
    'ui',
    'group',
    'image',
    'tilelist',
    'world',
    'resman',
    'entity'
    'app',
    
    # Functions
    
    'init',
    'quit'
]

def init():
    """ Initializes the ScrollBack.
    
        This initializes all of ScrollBack's modules in the recomended
        order.
    """
    
    # Initialize components
    
    # Video is init'd first because the Pygame manual says that most platforms
    # need pygame.display to be initialized before any other modules.
    video.init()
    event.init()
    ui.init()
    draw.init()
    resman.init()
    entity.init()

def quit():
    """ Quits all modules that should be quit after initialization.
        Also quits Pygame.
        FIXME: Actually, this just quits pygame. No other modules are quit.
    """
    pygame.quit()
